package com.dongdong.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dongdong.data.Result;
import com.dongdong.em.ResultEmnu;
import com.dongdong.pojo.TbItem;
import com.dongdong.service.EsService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("esController")
public class EsController {
    @Reference(timeout = 50000)
    private EsService esService;
    @RequestMapping("toSerach")
    public String toSerach(String title, Model model){
        model.addAttribute("title",title);
        return "search";
    }
    @RequestMapping("getInfoByTitle")
    @ResponseBody
    public Map<String,Object> getWord(String title, @RequestParam(defaultValue = "1")Integer pageNumber,
                       @RequestParam(defaultValue = "10")Integer pageSize){
        Map<String,Object> map = esService.getWord(title,pageNumber,pageSize);
        return map;

    }

}
